package com.xinongbest.mall.controller;

public class ThreadTest {
//    public static void main(String[] args) throws InterruptedException {
//        Thread thread = new Thread(()->{ for(int i=0; i<100 ;i++){
//            System.out.println("I'm doing my work" + i);
//            System.out.println("I'm interrupted?"+Thread.currentThread().isInterrupted()); }
//        });
//        thread.start();
//        Thread.sleep(1);
//        thread.interrupt();
//    }
    public static void main(String[] args) {
        User user = null;
        ThreadTest app = new ThreadTest();
        app.show(user);
        System.out.println(user);
    }
    public void show(User user) {
        if (user == null) {
            user = new User();
            user.setName("1111");
        } else {
            user = new User();
            user.setName("2222");
        }
    }
}

class User {
    private String name;

    public void setName(String name) {
        this.name = name;
    }
}
